package com.igd.framework.hibernate.springboot.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;

import com.igd.framework.hibernate.springboot.dto.Student;

public interface StudentDao extends CrudRepository<Student,Integer> {
	
	@Query("from Student where sex = ?1")
	List<Student> findBySex(String sex);
	
	@Query("from Student where name = :name")
	List<Student> findByName(@Param("name")String name);
	
	@Query("update Student set name=:name, tid=:tid, sex=:sex, grade=:grade where id = :id")
	void updateStudent(@Param("id")Integer id, @Param("id")String name, @Param("tid")Integer tid, @Param("sex")String sex, @Param("grade")Integer grade);

}
